/**
 * Created by Admin on 2017/12/26.
 */
define(function (require, exports, module) {
    var commonPaging=require("../common/commonPaging");
    var v2 =require("./industry.validator");
    var industryTpl = require("./tpl/industryTpl.html");
    var myWidGet = require("../common/myWidGet");
    require("../seajs-init");
    var p;

    var p=new commonPaging({
        htmlContainer: "#Js_page_industrycontent",
        pageContainer: "#Js_fs_paging",
        url: window.jkconfig.webapiurlv+"typemanage/pagequerypacindustry",
        tpl:industryTpl
    });
    p.init();
    var fatherBody = $(window.top.document.body);
    var editIndustryForm = fatherBody.find("#editIndustryForm");
    v2.editValidator(editIndustryForm);//添加行业

    $(function() {
        $("#platformName").html(platformName);
        var fatherBody = $(window.top.document.body);//找到父页面的body对象
        $("body").on("click",".btnAddArea",function(){
            fatherBody.find("#modal-addArea").show();
            fatherBody.find("#modal-addArea .modal-header label").html("添加行业管理");
            fatherBody.find("input[name=sort]").val("");
            fatherBody.find("input[name=name]").val("");
            fatherBody.find("input[name=id]").val("");
        }).on("click",".btnAddIndustry",function(){
            fatherBody.find("#modal-addIndustry").show();
            fatherBody.find("#modal-addIndustry .modal-header label").html("添加行业管理");
            fatherBody.find("input[name=sort]").val("");
            fatherBody.find("input[name=name]").val("");
            fatherBody.find("input[name=id]").val("");
        }).on("click", ".btnIndustryUpdate", function () {        //修改行业
            fatherBody.find("#modal-addIndustry").show();
            fatherBody.find("#modal-addIndustry .modal-header label").html("编辑行业管理");
            fatherBody.find("input[name=sort]").val($(this).attr("data-no"));
            fatherBody.find("input[name=name]").val($(this).attr("data-name"));
            fatherBody.find("input[name=id]").val($(this).attr("data-id"));
            // v2.editValidator("#editIndustryForm");
        }).on("click", ".btnIndustryRemove", function () {
            fatherBody.find("#deletIndustryModal .selectedIndustry").html($(this).attr("data-name")).attr("data-id",$(this).attr("data-id"));
            fatherBody.find("#deletIndustryModal").show();
        })
    })
})